from RPC.grpc.protobuf_test.proto import hello_pb2

# 生成pb文件不要改
request = hello_pb2.HelloRequest()
request.name = "小明"
res_str = request.SerializeToString()
print(res_str)

# 如何通过字符串反向生成对象
request2 = hello_pb2.HelloRequest()
request2.ParseFromString(res_str)
print(request2.name)
